<extend name="Public:index" />
<block name="main-crumb">
 <li class="active">平台基础设置</li>
</block>
<block name="main-content">
    <form id="add_form"  name="add_form" action="{:U(\'index\')}" method="post" class="definewidth m20">
        <table class="table table-bordered table-hover definewidth m10">
            <tr>
                <td width="10%" class="tableleft">项目名称：</td>
                <td >
                <input style="width:500px" type="text" name="data[pro_title]" id="parm_name" value="{:C('PRO_TITLE')}" />
                </td>
              </tr>
              <tr>
                <td class="tableleft">登录首页地址：</td>
                <td >
                    <input type="text" style="width:500px" name="data[pro_index]" id="status_var"  value="{:C('PRO_INDEX')}"/>

                </td>
              </tr>
               <tr>
                <td class="tableleft">项目图片：</td>
                <td >
                    <input type="file" multiple="multiple" id="inputfile" name="inputfile" class="photo">
                    <input type="hidden" name="data[img_path]" id="img_path" value="{:C('PRO_IMAGE_PATH')}"/>
                    <input type="button" class="btn btn-success" value="上传"  id="onUpload" onclick="upLoad()"/>

                    <br/>
                    <img src="__PUBLIC__/web/pro_img/{:C('PRO_IMAGE_PATH')}"  id='show_img' style="width: 500px;height: 300px;" class="">

                </td>
              </tr>

              <tr>
                <td colspan="3">

                  <input type="submit"class="btn btn_primary" id="sub" name="sub" value="保存"  />&nbsp;&nbsp;&nbsp;&nbsp;
                  <input type="reset" class="btn btn-success" value="清空" />
                </td>
              </tr>

        </table>
    </form>
</block>
<block name="timeout"></block>
<block name="myscript">
     <script type="text/javascript" src="__PUBLIC__/web/js/ajaxfileupload.js"></script>
     <script src="__PUBLIC__/web/js/common.js"></script>
     <script>
         //图片异步上传
    function upLoad(){


         $.ajaxFileUpload
        (
        {
            url: "{:U(\'edit_img\')}", //用于文件上传的服务器端请求地址
            secureuri: false, //是否需要安全协议，一般设置为false
            fileElementId: 'inputfile', //文件上传域的ID
            dataType: 'json', //返回值类型 一般设置为json
            data:{},
            success: function (data, status)  //服务器成功响应处理函数
            {
                if(data.status == '1'){
                   $('#show_img').attr("src",'__PUBLIC__/web/pro_img/'+data.path);
                   $("#img_path").val(data.path);
                }else{
                    alert(data.path);
                }
            },
            error: function (data, status, e)//服务器响应失败处理函数
            {

            }
        }

       )
    }

     </script>
</block>